package com.studentmanager.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.studentmanager.dao.StudentDAOImpl;
import com.studentmanager.vo.Student;

public class SearchGradeByIdServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
         String stNo=request.getParameter("searchgradeId");
         StudentDAOImpl studentdao=new StudentDAOImpl();
         Student student=studentdao.findGradeById(stNo);
         request.setAttribute("student", student);
         String mainPage = "ShowGrade.jsp";
 		 request.setAttribute("mainPage", mainPage);
 		 RequestDispatcher dispatcher = request.getRequestDispatcher("Teacher.jsp");
 		 dispatcher.forward(request, response);
	}

}
